//
//  HOMNSSetTests.m
//  HigherOrderMessaging
//
//  Created by Ofri Wolfus on 14/10/06.
//  Copyright 2006 Ofri Wolfus. All rights reserved.
//

#import "HOMNSSetTests.h"


@implementation HOMNSSetTests

- (id)init {
	if ((self = [super init])) {
		unsigned int i;
		
		smallSet = [[NSSet alloc] initWithObjects:@"a", @"b", @"abc", nil];
		largeSet = [[NSMutableSet alloc] init];
		largeSetResult = [[NSMutableSet alloc] init];
		
		for (i = 0; i < 10000; i++)
			[(NSMutableSet *)largeSet addObject:[NSString stringWithFormat:@"%u", i]];
	}
	
	return self;
}

- (void)dealloc {
	[smallSet release]; smallSet = nil;
	[largeSet release]; largeSet = nil;
	[largeSetResult release]; largeSetResult = nil;
	[super dealloc];
}

// Instead of copying this in every subclass, we do it here
- (BOOL)verifyResult:(NSSet *)set ofTest:(SEL)sel {
	NSString *name = NSStringFromSelector(sel);
	
	if ([name hasPrefix:@"testLargeSet"])
		DPTestAssert([set isEqualToSet:largeSetResult], @"The resulting set doesn't match the expected result. Result = %@", set);
	
	return [super verifyResult:set ofTest:sel];
}

@end
